﻿// ***********************************************************
// 菜单的数据访问类
// Creator:yehui  Date:2013-02-19
// ***********************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using VipSys.SystemEntity;
using VipSys.Common.Library;

namespace VipSys.DataLayer
{
    
    public class MenuAccess
    {
        public static readonly MenuAccess Instance = new MenuAccess();
        private XMLBase m_XmlBase;
        public MenuAccess()
        {
            m_XmlBase = new XMLBase(SystemParam.Instance.WorkPath + "\\SystemConfig.xml");
        }
        public short GetMenus(ref List<SysMenu> lstMenus)
        {
            lstMenus.Clear();
            XmlNodeList xmlNodeList = this.m_XmlBase.SelectNodeList(SystemData.XmlConfigItem.Menu);
            foreach (XmlNode node in xmlNodeList)
            {
                SysMenu menu = new SysMenu();
                menu.ID = this.m_XmlBase.ReadXmlNode(node, SystemData.XmlMenu.ID);
                menu.Text = this.m_XmlBase.ReadXmlNode(node, SystemData.XmlMenu.TEXT);
                menu.ParentID = this.m_XmlBase.ReadXmlNode(node, SystemData.XmlMenu.PARENT_ID);
                menu.Qtip = this.m_XmlBase.ReadXmlNode(node, SystemData.XmlMenu.QTIP);
                menu.Leaf = this.m_XmlBase.ReadXmlNode(node, SystemData.XmlMenu.LEAF);
                menu.IconCls = this.m_XmlBase.ReadXmlNode(node, SystemData.XmlMenu.ICONCLS);
                menu.Role = this.m_XmlBase.ReadXmlNode(node, SystemData.XmlMenu.ROLE);
                lstMenus.Add(menu);
            }
            return SystemData.ReturnValue.OK;
        }
    }

  
}


